/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package net.stuffrepos.bricknetcenter.util.validation;

/**
 *
 * @author Eduardo H. Bogoni <eduardobogoni@gmail.com>
 */
public class DefaultConstraint<ValueType> implements Constraint<ValueType> {
    private final boolean required;

    public DefaultConstraint(boolean required) {
        this.required = required;
    }

    @Override
    public boolean isValid(ValueType value) {
        return (value != null) || (required == false);
    }

}
